<tagLib name="html" />

<include file="Public:header" />

<div class="container" id="cpcontainer">
    <div class="itemtitle">
        <h3>{$Think.lang.newsletter.manage_newsletter}</h3>
        <ul class="tab1">
            <li><a href="__URL__/newsletterList"><span>{$Think.lang.newsletter.all_newsletter}</span></a></li>
            <li><notempty name="rs"><a href="__URL__/editNewsletter/letter_id/{$rs.letter_id}"><span>{$Think.lang.newsletter.edit_newsletter}</span></a><else/><a href="__URL__/addNewsletter"><span>{$Think.lang.newsletter.add_newsletter}</span></a></notempty></li>
            <li class="current"><a href="__URL__/newsletterQueue"><span>{$Think.lang.newsletter.newsletter_queue}</span></a></li>
        </ul>
    </div>
    <notempty name="newsletter"><h3>{$Think.lang.newsletter.subject} :: {$newsletter.subject}</h3></notempty>
    <form id="cpform" name="cpform" method="post" action="">
    <input type="hidden" name="op" value="save" />
    <table class="tb tb2 fixpadding">
        <tr>
            <th>{$Think.lang.newsletter.newsletter_id}</th>
            <th>{$Think.lang.newsletter.recipient}</th>
            <th>{$Think.lang.newsletter.priority}</th>
            <th>{$Think.lang.newsletter.failed_count}</th>
            <th>{$Think.lang.newsletter.last_send_time}</th>
            <th width="10%">{$Think.lang.mark}</th>
        </tr> 
        <volist name="list" id="vo">
        <tr class="item">
            <td>{$vo.letter_id}</td>
            <td><a href="#" title="{$vo.username}">{$vo.email}</a></td>
            <td>
                <switch name="vo.priority">
                    <case value="1">{$Think.lang.newsletter.priority_high}</case>
                    <case value="2">{$Think.lang.newsletter.priority_normal}</case>
                    <case value="3">{$Think.lang.newsletter.priority_low}</case>
                </switch>
            </td>
            <td><span class="count">{$vo.failed_count}</span></td>
            <td><notempty name="vo.last_send_time">{$vo.last_send_time|format_date}<else/>{$Think.lang.newsletter.pending}</notempty></td>
            <td><input type="checkbox" class="checkbox" name="mods[]" value="{$vo.queue_id}" /></td>
        </tr>
        </volist> 
        <tr class="nobg">
            <td colspan="5">
                <div class="fixsel right">
                    <input class="btn" type="button" value="{$Think.lang.delete_selected}" onclick="submitForm('delete_selected');" />
                </div>
            </td>
            <td><input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll('prefix', this.form, 'mods')" /><label for="chkall">{$Think.lang.check_all}</label></td>
        </tr>
        <tr class="nobg"><td colspan="15"><div class="cuspages right"><div class="pages">{$pagination}</div></div></td></tr>
    </table>
    </form>
</div>

<script type="text/javascript">
function submitForm(action){
    if('delete_selected' == action){
        var action = '__URL__/removeTargetUser';
        $('#cpform').attr('action', action);
    }
    $('#cpform').submit();
}
</script>

<include file="Public:footer" />
